package cn.levi.path.configuration;

import cn.levi.path.component.DefaultURLPathHandler;
import cn.levi.path.component.URLPathHandler;
import cn.levi.path.configuration.UrlProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @author lei
 * @since 2024/11/26
 */
@Configuration
@Import(UrlProperties.class)
public class URLPathAutoConfiguration {


	@ConditionalOnMissingBean
	@Bean
	@ConditionalOnProperty(prefix = "simple-tool.file-path",name = "enable",havingValue = "true",matchIfMissing = true)
	public URLPathHandler  getURLPathHandler(UrlProperties urlProperties) {
		return new DefaultURLPathHandler(urlProperties);
	}

}
